# Makefile for the complete TPIE system.
# $Id: Makefile.in,v 1.24 2005/01/14 15:31:56 tavi Exp $

# To compile with debugging symbols, set this to 1.
MINUSG = 0
# To compile with gprof symbols, set this to 1.
MINUSPG = 0

MY_DEFS := -DHAVE_CONFIG_H
MY_LIBS := 

# Send all variables into recursive makes.
export

# The directories storing the components of the system

LIBPATH := ./lib/
LIBSRCPATH := $(LIBPATH)src/
TESTPATH := ./test/
APPSPATH := ./apps/
INCPATH := ./include/

# Public targets.

usage:
	@echo $(MAKE) "[ all | include | lib | test | clean | distclean ]"

all: include lib test 

include:
	$(MAKE) -C $(INCPATH) all

lib: include
	$(MAKE) -C $(LIBSRCPATH) all
	$(MAKE) -C $(LIBPATH) all

test: 
	$(MAKE) -C $(TESTPATH) all

depend: include
	$(MAKE) -C $(LIBSRCPATH) $@
	$(MAKE) -C $(TESTPATH) $@

appdirs := bkdtree convex_hull list_rank nas_benchmarks rtree \
					 spatial_join visualize_btree
clean:
	rm -f $(TESTPATH)/Makefile.depend; touch $(TESTPATH)/Makefile.depend
	$(MAKE) -C $(TESTPATH) $@
	$(MAKE) -C $(LIBPATH) $@
	$(foreach dir, $(appdirs),($(MAKE) -C $(APPSPATH)$(dir) $@);)
	$(MAKE) -C $(INCPATH) $@

dirs := ./ $(TESTPATH) $(LIBPATH) $(LIBSRCPATH) $(INCPATH)
					 
distclean: clean
	rm -f config.log config.cache config.status
	$(foreach dir,$(dirs),(rm -f $(dir)/*~; rm -f $(dir)/Makefile);)
	$(foreach dir, $(appdirs),(rm -f $(APPSPATH)$(dir)/*~);)
	$(foreach dir, $(appdirs),(rm -f $(APPSPATH)$(dir)/Makefile);)

# Private targets.

.PHONY : clean lib include test usage all distclean

